package com.prothink.controller;

import com.prothink.entity.JsProductCategroy;
import com.prothink.entity.RequestData;
import com.prothink.service.JsProductCategroyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName : JsProductCategroyController  //类名
 * @Description : 商品分类表  //描述
 * @Author : Zhang //作者
 * @Date: 12/16  16:31
 */
@CrossOrigin
@RestController
@RequestMapping("/jsProductCategroy")
public class JsProductCategroyController {

    @Autowired
    private JsProductCategroyService jsProductCategroyService;

    /*获取分类信息*/
    @RequestMapping("/getTree")
    public RequestData getTree(){
        List<JsProductCategroy> list=jsProductCategroyService.getTree();
        System.out.println(list.get(0));
        return list!=null?RequestData.buildSuccess(list):RequestData.buildError("服务器错误");
    }
}
